package com.chen.winnerframework.domain.dto.user;

import cn.hutool.core.bean.BeanUtil;
import com.chen.winnerframework.domain.entity.mybatis.rbac.User;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 用户信息 数据传输对象
 *
 * @author chengy
 * @date 2022/11/27
 */
public class UserInfoDto {

    /**
     * id
     */
    @NotNull(message = "id不能为空")
    @ApiModelProperty(value = "id", required = true)
    private Integer id;

    /**
     * 名称
     */
    @NotBlank(message = "名称不能为空")
    @ApiModelProperty(value = "名称", required = true)
    private String name;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空")
    @ApiModelProperty(value = "手机号", required = true)
    private String phoneNumber;

    /**
     * 邮箱
     */
    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式有误")
    @ApiModelProperty(value = "邮箱", required = true)
    private String email;

    /**
     * 性别（1男 0女）
     */
    @NotNull(message = "性别不能为空")
    @ApiModelProperty(value = "性别（1男 0女）", required = true)
    private Integer sex;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public User toDo() {
        return BeanUtil.toBean(this, User.class);
    }

}
